package com.cjj.mvpsample.view.activity;

import android.app.Activity;
import android.os.Bundle;

import com.cjj.mvpsample.presenter.BasePresenter;

/**
 * 基类
 * @Author：Created by cjj on 16/8/22.
 * @Blog：jianjunchen.net
 */
public abstract class BaseActivity<V,T extends BasePresenter<V>> extends Activity{

    public T presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        presenter = createPresenter();
        presenter.attachView((V)this);
    }

    public abstract T createPresenter();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.detachView();
    }
}
